Skip to content

docs(social): credit pricing (5 + posts) + auth on scrape endpoints#259

Merged
sweetmantech merged 2 commits into
mainfrom
feat/social-scrape-credit-pricing
Jul 2, 2026
Merged

docs(social): credit pricing (5 + posts) + auth on scrape endpoints#259
sweetmantech merged 2 commits into
mainfrom
feat/social-scrape-credit-pricing

Conversation

@sweetmantech

@sweetmantech sweetmantech commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Contract PR for the credit-gate item on recoupable/chat#1836 (pricing per the cost research). Merge before the api PR.

  • Both scrape endpoints: "Costs 5 credits, plus 1 credit per post requested via posts" (bulk: per social profile scraped).
  • Both: new 402 response, schema mirroring ResearchInsufficientCreditsResponse (matches buildInsufficientCreditsResponse exactly: error/remaining_credits/required_credits/checkoutUrl/declineReason?).
  • POST /api/artist/socials/scrape: adds security (apiKeyAuth/bearerAuth) + 401/403 responses — the endpoint gains auth in the api PR (it currently has none, flagged in the credits audit).

Verification

Both OpenAPI files re-parse; diff is additive.

🤖 Generated with Claude Code


Summary by cubic

Moved social scrape pricing to credits.mdx (5 credits + 1 per posts per profile) and documented credit-gating and auth. Both scrape endpoints now include 402 insufficient-credits responses; POST /api/artist/socials/scrape adds API-key/Bearer auth with 401/403.

  • Migration
    • Handle HTTP 402 from both endpoints; use checkoutUrl to guide top-ups.
    • For POST /api/artist/socials/scrape, include API key or Bearer token and handle 401/403.

Written for commit 9b57882. Summary will update on new commits.

Review in cubic

Both scrape endpoints now cost 5 credits plus 1 credit per requested
post (per profile on the bulk endpoint). Adds the 402 insufficient-credits
response (mirrors the research family's schema) to both, and documents
auth (security + 401/403) on POST /api/artist/socials/scrape, which
gains authentication as part of the same change.

Contract for the credit-gate item on recoupable/chat#1836; api PR follows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@sweetmantech, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 16f502c1-9c03-48a8-8490-d9d590b5994f

📥 Commits

Reviewing files that changed from the base of the PR and between 615cf5d and 9b57882.

📒 Files selected for processing (3)
  • api-reference/openapi/releases.json
  • api-reference/openapi/social.json
  • credits.mdx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/social-scrape-credit-pricing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mintlify

mintlify Bot commented Jul 2, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
recoup-docs 🟢 Ready View Preview Jul 2, 2026, 5:53 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

…-endpoint

Per review direction: no sibling endpoint states its credit cost in its
reference description, so the price moves to credits.mdx's What's-billed
table (social scrape leaves the free row). The OpenAPI diff keeps only
what the endpoints now actually emit: 402 insufficient-credits responses
(research-family precedent) and auth (security + 401/403) on the bulk
endpoint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="credits.mdx">

<violation number="1" location="credits.mdx:17">
P3: The "Cost per endpoint" table at the bottom of the page omits the two social scrape endpoints now that they're billed. All other billed families (research variants, image generate, chat) have entries there — social scrape should too for consistency.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread credits.mdx
@@ -14,7 +14,8 @@ Some Recoup endpoints are billed in **credits** — primarily endpoints that hit
| **Research** ([`/api/research/*`](/api-reference/research/search)) | Yes | Each successful call deducts credits. Costs vary by endpoint and parameters (e.g. [`enrich`](/api-reference/research/enrich) charges by processor tier; [`extract`](/api-reference/research/extract) charges by URL count). |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The "Cost per endpoint" table at the bottom of the page omits the two social scrape endpoints now that they're billed. All other billed families (research variants, image generate, chat) have entries there — social scrape should too for consistency.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At credits.mdx, line 17:

<comment>The "Cost per endpoint" table at the bottom of the page omits the two social scrape endpoints now that they're billed. All other billed families (research variants, image generate, chat) have entries there — social scrape should too for consistency.</comment>

<file context>
@@ -14,7 +14,8 @@ Some Recoup endpoints are billed in **credits** — primarily endpoints that hit
 | **Content generation** ([`/api/image/generate`](/api-reference/image/generation)) | Yes | Image generation is priced per call. |
 | **AI Chat — streaming** ([`POST /api/chat`](/api-reference/chat/workflow)) | Yes | Variable cost based on model token usage, with a per-request minimum. |
-| **Everything else** | Free at the API layer | [Artist CRUD](/api-reference/artists/list), [sandboxes](/api-reference/sandboxes/list), [sessions](/api-reference/sessions/get), [scheduled tasks](/api-reference/tasks/get), [social integrations](/api-reference/social/scrape), [account/org management](/api-reference/accounts/id), [agent signup](/api-reference/agents/signup), [Spotify proxies](/api-reference/spotify/search), etc. Subscription gating may still apply. |
+| **Social scrape** ([`/api/socials/{id}/scrape`](/api-reference/social/scrape), [`/api/artist/socials/scrape`](/api-reference/artist/socials-scrape)) | Yes | 5 credits, plus 1 credit per post requested via `posts` — per social profile scraped. |
+| **Everything else** | Free at the API layer | [Artist CRUD](/api-reference/artists/list), [sandboxes](/api-reference/sandboxes/list), [sessions](/api-reference/sessions/get), [scheduled tasks](/api-reference/tasks/get), [account/org management](/api-reference/accounts/id), [agent signup](/api-reference/agents/signup), [Spotify proxies](/api-reference/spotify/search), etc. Subscription gating may still apply. |
 
</file context>

@sweetmantech sweetmantech merged commit f70b9ff into main Jul 2, 2026
3 checks passed
sweetmantech added a commit to recoupable/api that referenced this pull request Jul 2, 2026
…744)

Charges 5 credits plus 1 credit per requested post for each social
profile scraped, priced from measured Apify costs (recoupable/chat#1836
cost research: worst case is YouTube at ~$0.003 × 2×posts items; 5+posts
at 1 credit = $0.01 keeps ≥1.75x margin at posts=100).

- getSocialScrapeCreditCost: 5 + (posts ?? 0)
- ensureSocialScrapeCredits / deductSocialScrapeCredits: mirror the
  research family's gate (ensureCreditsOrShortCircuit → 402 with
  checkoutUrl) and deduct-on-success (recordCreditDeduction, never throws)
- POST /api/socials/{id}/scrape: validator gates after auth+access;
  handler deducts only when the Apify run started (no charge on
  unsupported platform or scrape-start failure)
- POST /api/artist/socials/scrape: gains auth (validateAuthContext) +
  artist access check (checkAccountArtistAccess) — it previously had
  none; gates on (5+posts) × linked profiles, deducts per profile whose
  scrape actually started; [] with no charge when the artist has no socials

Contract: recoupable/docs#259. Closes the credit-gate item on
recoupable/chat#1836.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant